{% extends "base.html" %}
{%- block body %}
        <section id="main" data-role="page">
            <header data-role="header" data-position="fixed">
                <h3>AGM销售系统</h3>
            </header>
            <div data-role="content">
                <ul data-role="listview" data-inset="true">
                    <li><a href="#additem">增加项目</a></li>
                    <li><a href="#qritems">生成二维码</a></li>
                    <li><a href="selllist">清单查询</a></li>
                    {% if agmsell.get('openid') %}
                    <li><a id="wechatset" href="#we_setting">微信设置</a></li>
                    {% elif session.get('wechatuserid') %}<li><a id="wechatbind" href="#">绑定微信</a></li>
                    {% else %}<li><a id="wechatlogin" href="#">登录微信</a></li>{% endif %}
                </ul>  
            </div>
            <footer data-role="footer" data-theme="b" data-position="fixed"><h3><small>©2015 音速风暴</small></h3></footer>
        </section> 
        <section id="additem" data-role="page">
            <header data-role="header" data-position="fixed">
                <h3>增加项目</h3>
            </header>
            <div data-role="content">
                <form data-ajax="false" id="additempost">
                    <input name="title" placeholder="项目标题">
                    <input name="cost" type="number" placeholder="消费积分">
                    <input type="submit" value="提交">
                </form>         
            </div>
            <footer data-role="footer" data-theme="b" data-position="fixed"><h3><small>©2015 音速风暴</small></h3></footer>
        </section> 
        <section id="qritems" data-role="page">
            <header data-role="header" data-position="fixed">
                <h3>生成二维码</h3>
            </header>
            <div data-role="content">
                <ul data-role="listview" data-inset="true">
                    {% for qritem in qritems %}<li><a href="#" class="createqr" data-lc-id="{{qritem.id}}">{{ qritem.get('title') }}|{{ qritem.get('cost')}}</a></li>{% endfor %}
                </ul>
            </div>
            <footer data-role="footer" data-theme="b" data-position="fixed"><h3><small>©2015 音速风暴</small></h3></footer>
        </section>
        <section id="qrdisplay" data-role="page">
            <header data-role="header" data-position="fixed">
                <h3>二维码显示</h3>
            </header>
            <div data-role="content">
                <div class="qrimg"></div>
                <div class="qrstat ui-bar-a"></div>
                <a href="#" class="refreshqrstat ui-disabled" data-role="button">刷新</a>
            </div>
            <footer data-role="footer" data-theme="b" data-position="fixed"><h3><small>©2015 音速风暴</small></h3></footer>
        </section>
        <section id="we_setting" data-role="page">
            <header data-role="header" data-position="fixed">
                <h3>微信设置</h3>
            </header>
            <div data-role="content">
                <div data-role="collapsible">
                <h5>新增微信快捷代码</h5>
                <form id="we_set_form">
                    <select name="lc_id">
                        {% for qritem in qritems %}<option value="{{qritem.id}}">{{qritem.get('title')}}|{{qritem.get('cost')}}</option>{% endfor %}
                    </select>
                    <input name="shortcut" placeholder="关键字输入,注意以@为开头">
                    (注意:输入的关键字在微信公众号需以@为开头)
                    <input type="submit" id="we_set_post" value="增加">
                </form></div>
                <div class="shortcutdisplay">
                    <h5>微信快捷关键字列表</h5>
                    <table class="ui-body-a ui-table table-stroke table-stripe">
                        <thead>
                            <tr>
                                <th>标题</th>
                                <th>消费积分</th>
                                <th>关键字</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for qritem in qritems if qritem.get('shortcut') %}<tr data-lc-id="{{qritem.id}}">
                                <td>{{qritem.get('title')}}</td>
                                <td>{{qritem.get('cost')}}</td>
                                <td>{{qritem.get('shortcut')}}</td>
                            </tr>{% endfor %}
                        </tbody>
                    </table>
                </div>
                <div class="ui-field-contain">
                    <label for="flip_we_message">微信提示信息:</label>
                    <select name="flip_we_message" id="flip_we_message" data-role="flipswitch">
                        <option value="off" {%if not agmsell.get('messageswitch')%}selected{% endif %}>关</option>
                        <option value="on" {%if agmsell.get('messageswitch')%}selected{% endif %}>开</option>
                    </select>
                </div>
                <a href="#" data-role="button" id="wechatunbind">微信解绑</a>
            </div>
            <footer data-role="footer" data-theme="b" data-position="fixed"><h3><small>©2015 音速风暴</small></h3></footer>
        </section>        
    {% endblock %}